package domain;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.Date;

/*
 * 日志类
 * */
public class Log {

	public void writeToFile(String message) {
		String filePath = "log/log.txt";
		Date date = new Date();
		try {
			File file = new File(filePath);
			if (!file.exists()) {
				file.createNewFile();
			}
			FileWriter fw = new FileWriter(filePath, true);
			BufferedWriter bw = new BufferedWriter(fw);
			bw.append("\n" + date + " " + message);
			bw.close();
			fw.close();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
